package cz.muni.fi.pa165.musiclibrary.musiclibraryclient;

import cz.muni.fi.pa165.musiclibrary.Genre;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import javax.swing.BorderFactory;
import javax.swing.JList;
import javax.swing.JTextArea;
import javax.swing.ListCellRenderer;

/**
*
* @author Radoslav Stefanik 
* 2012-12-09T22:02:14+0100
*/
public final class GenreListRenderer extends JTextArea implements ListCellRenderer<Genre> {

    @Override
    public Component getListCellRendererComponent(JList<? extends Genre> list, Genre value, int index, boolean isSelected, boolean cellHasFocus) {
        if (isSelected) {
            setBackground(Color.blue);
            setForeground(Color.white);
        } else {
            setBackground(list.getBackground());
            setForeground(list.getForeground());
            setBorder(BorderFactory.createLineBorder(Color.white));
        }
        setText(value.getName());
        setFont(new Font("Verdana", Font.PLAIN, 13));
        return this;
    }

}